Shuffle the elements randomlyΒΆ
Shuffle the following elements randomly.
Sample elements:
[1, 2, 3, 4, 5, 6, 7]
Expected output:
[2, 1, 7, 5, 3, 4, 6]
import random
nums = [1, 2, 3, 4, 5, 6, 7]
random.shuffle(nums)
print(nums)
Output:
[5, 3, 4, 7, 1, 6, 2]